<template>
  <LayOut />
</template>

<script setup lang="ts">
import { setAssociated } from '@/utils/setAssociated'
import LayOut from '@/layout/index.vue'
import Cookies from 'js-cookie'
import useUserStore from '@store/modules/user'

if (process.env.CHAT_TEST) {
  Cookies.set(`feijiuImUserToken_${process.env.CHAT_TEST_USERID}`, `${process.env.CHAT_TEST_IMTOKEN}`);
}


document.addEventListener('contextmenu', function (event) {
  event.preventDefault()
})

const userStore = useUserStore()

const clearCache = () => {
  localStorage.clear(); // 清除 LocalStorage
  userStore.userLogout()
};

onMounted(() => {
  window.setAssociated = setAssociated
  window.addEventListener("beforeunload", clearCache);
})

onUnmounted(() => {
  window.removeEventListener("beforeunload", clearCache);
})
</script>

<style lang="scss"></style>
